<?php
// +----------------------------------------------------------------------
// | DCloud [ WE CAN DO IT MORE SIMPLE ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2018 http://www.yunku.cloud All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 老猫 <DCloud@126.com>
// +----------------------------------------------------------------------
namespace app\admin\controller;

use dc\controller\AdminBaseController;
use dragon\Entity\Rescue;

class RescueController extends AdminBaseController
{

    /**
     * 搜救列表
     */
    public function index() {
        $keyword = $this->request->param('keyword', '', 'trim');

        $map = [];
        $keyword and $map['user_name'] = ['like', '%'.$keyword.'%'];

        $list = Rescue::where($map)->order('create_time desc')->paginate($this->perpage);

        $this->assign('list', $list);
        $this->assign('page', $list->render());
        return $this->fetch();
    }

    /**
     * 修改
     */
    public function save() {
        $rescue = Rescue::get($this->request->param('id'));
        $rescue->save($this->request->post());

        $this->success('操作成功');
    }
}
